package utils;


import dto.FileDto;
import error.FileErrorCode;
import error.FileServiceException;
import lombok.extern.slf4j.Slf4j;
import org.csource.common.MyException;

import java.io.IOException;


/**
 * @author xj
 * @since  1.0
 */
@Slf4j
public class DeleteFileUtil {

    public static void deleteFile(FileDto file){
        try {
          FileUtil.getStorageClient().delete_file(file.getFileGroupPath(), file.getFileUrl());
        } catch (IOException | MyException e) {
            log.error("fdfs删除IOException:{0}", e);
            throw  new FileServiceException(FileErrorCode.FILE_DELETE_FAILE);
        }
    }
    
}
